import React, { Component } from 'react'
import {Route, Switch, Redirect} from 'react-router-dom'
import MyNavLink from '../../components/MyNavLink'
import News from './News'
import Messages from './Messages'

export default class Home extends Component {
  render() {
    return (
      <div>
        <h2>home content</h2>
        <div>
          <ul className='nav nav-tabs'>
            <li>
              <MyNavLink to='/home/news'>News</MyNavLink>
            </li>
            <li>
              <MyNavLink to='/home/messages'>Messages</MyNavLink>
            </li>
          </ul>
        </div>
        {/* 注册路由 */}
        <Switch>
          <Route path='/home/news' component={News}></Route>
          <Route path='/home/messages' component={Messages}></Route>
          <Redirect to='/home/news'></Redirect>
        </Switch>
      </div>
    )
  }
}
